{smcl}
{* $Id$ }
{* $Date$}{...}
{cmd:help motionchart}
{hline}

{title:Create an HTML file that will graph your data as a Google Motion Chart}


{title:Syntax}

{p 8 17 2}
{cmdab:motionchart}
{varlist}
{ifin}
[{cmd:,} {it:options}]

{synoptset 20 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Output file}
{synopt:{opt rep:lace}}overwrites an existing {it:using} file{p_end}
{synopt:{opt tit:le(string)}}adds a title to the top of the file{p_end}
{synopt:{opt tex:t(string)}}adds text above the chart (below the title, if any){p_end}
{synopt:{opt not:e(string)}}adds text below chart{p_end}
{synopt:{opt tim:estamp}}prints output file to screen after running command{p_end}
{synopt:{opt ty:pe}}{p_end}
{syntab:Chart Options}
{synopt:{opt h:eight(#)}}declares the height of chart (in pixles){p_end}
{synopt:{opt w:idth(#)}}declares the width of chart (in pixles){p_end}
{synopt:{opt s:tate(string)}}declares the {browse "http://code.google.com/apis/visualization/documentation/gallery/motionchart.html#Motion_Chart_initial_state":initial state} for chart{p_end}
{synopt:{opt hide:panel}}hides the right-hand panel{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
{cmd:state} will override the {cmd:hidepanel} option.{p_end}


{title:Description}

{pstd}{cmd:motionchart} can be used to create a "Motion Chart."  {p_end}
{phang}1 - In Stata, you type use this command, which is very similar to 
the {help graph} syntax. {p_end}
{phang}2 - This program will create an HTML file that will impliment Google's 
"Motion Chart" Visualization API{p_end}
{phang}3 - You open with your internet browser to view a "Motion Chart".   {p_end}

A "Motion Chart" is a scatter plot for time-series data.  You can hit "play" and 
see how the points move over time.  They were made famous, for example, by Hans Rosling's 
{net "http://www.gapminder.org/":internet videos}.

{title:Syntax/Options}

{pstd}The number of variables in {varlist} must contain at least two variables:{p_end}
{phang}- The first variable should be the variable that identifies the entity names.{p_end}
{phang}- The second variable must contain time (integer) values.{p_end}
{phang}- All additional variables will be used to form the "y-axis" of the chart, 
categorical variables, and/or observation weights.  {p_end}

{pstd}{error}Note{text}: This preliminary version on the program only handles integer 
dates (e.g., years), not month/day/year, for date input values.   This will be added to 
future versions. Also, variables with a value {help label} will just export the numerical 
value, not the label.  You should use {help decode} first if you want the value labels.

{pstd}The state option allows you to pass the full 
"{browse "http://code.google.com/apis/visualization/documentation/gallery/motionchart.html#Motion_Chart_initial_state" :initial state}" 
into the options array. {p_end}

{phang}{cmd:. motionchart ..., state(`"{c -(} Code for Google's API {c )-}"') ...}   
(Inlude brackets ({c -(}{c )-}) and full quotes ({c 'g}"  "').{p_end}


{title:API}

{pstd}
For detailed information about Motion Charts, see the Google Visualization API website:
{browse "http://code.google.com/apis/visualization/documentation/gallery/motionchart.html"}


{title:You probably need to change your Flash Security Settings}

{pstd}In my case, I had trouble getting 
this working because the default Flash security settings were blocking the .html files 
generated by this program.  That is becuase, by default, Adobe does not "trust" files on your
local computer. I fixed the problem by doing this:{p_end}

{phang} 1 - For the Adobe Flash Player, open the "Global Security Settings" panel.  
Open the "Global Settings" configuration panel.  
{browse "http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html":Click here to open your configuration settings}. {p_end}
{phang} 2 - On the "Global Security Settings" tab, you'll see a  box that says "Always trust files in these locations," add the 
disk drive (e.g., C:\), folder (e.g., C:\my folder\), or file (e.g., C:\my folder\mymotionchart.html) that has your motionchart.{p_end}


{title:Example}

{phang}{cmd:. sysuse bplong.dta , clear}{p_end}
{phang}{cmd:. gen year = 2007+when}{p_end}
{phang}{cmd:. decode sex , gen(gender)}{p_end}

{phang}{cmd:. motionchart patient year bp sex using "my_test.html" in 115/125 , replace title("Blood Pressure") subtitle("Example motionchart: created in Stata with motionchart.ado")}{p_end}

	  {it:({stata motionchart_example:click to run})}
{* motionchart_example.ado}{...}


{title:Credits}
{* $Id$ }

{phang}Stata .ado file by Keith Kranker

{phang}$Date${p_end}


{title:See Also}

{psee}{help varlist}, {help if}, {help graph}, {help decode}
